# Contributor: Aaron Hurt <ahurt@ena.com>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=pacparser
pkgver=1.4.5
pkgrel=1
pkgdesc="A library to parse proxy auto-config (PAC) files"
url="https://pacparser.manugarg.com/"
arch="all"
license="LGPL-3.0-or-later"
makedepends="bash python3-dev py3-setuptools"
subpackages="py3-$pkgname-pyc:pyc py3-$pkgname:pymod $pkgname-doc $pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/manugarg/pacparser/archive/refs/tags/v$pkgver.tar.gz
	spidermonkey-make.patch
	gcc14.patch
	"

# secfixes:
#   1.4.0-r0:
#     - CVE-2019-25087

prepare() {
	default_prepare

	echo "VERSION=v$pkgver" > src/version.mk
}

build() {
	# There's some concurrency problem, so we must disable parallel build.
	# https://github.com/pacparser/pacparser/issues/27
	PYTHON=python3 make -j1 -C src pactester pymod
}

package() {
	make -C src DESTDIR="$pkgdir" install install-pymod
}

pymod() {
	depends="python3"
	replaces="py-pymod" # Backwards compatibility
	provides="py-pymod=$pkgver-r$pkgrel" # Backwards compatibility

	amove usr/lib/python*
}

sha512sums="
fabbfa5c5ebd2a884187e53db27015b16587cba2ae30da1fdec92ca211b1f0ecd2839222341cd0eca9e709ada4e9efcd686b713e4f1e5621507070a6300ad164  pacparser-1.4.5.tar.gz
99753cfb450e685d866d80e33c58320584c15ec625a0745d4ea2b9d3a6eadb2308563d1b86bdc656a66d255b58a426a89cd5f14ea3b472d04a70a99ef3c1a2bf  spidermonkey-make.patch
9fa2a02606a8fae20e36afa4700a62e2c2c2ab174d34d51f6821379520f21167df687bf5d98316916cfdc6451df418b777b67dfcea44d168f417328b9fb12cb0  gcc14.patch
"
